﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ChannelInfo.cs" company="LeetSoftwerx">
//   Copyright ©2012 LeetSoftwerx
// </copyright>
// <summary>
//   The channel info.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Irclib
{
    using System;
    using System.Diagnostics.Contracts;

    /// <summary>
    /// The channel info.
    /// </summary>
    public struct ChannelInfo
    {
        #region Constants and Fields

        /// <summary>
        /// The _name.
        /// </summary>
        private readonly string name;

        /// <summary>
        /// The _number visible.
        /// </summary>
        private readonly int numberVisible;

        /// <summary>
        /// The _topic.
        /// </summary>
        private readonly string topic;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelInfo"/> struct. 
        /// Creates a new ChannelInfo structure
        /// </summary>
        /// <param name="name">
        /// The name of the channel 
        /// </param>
        /// <param name="topic">
        /// The topic of the channel including formatting information 
        /// </param>
        /// <param name="numberVisible">
        /// The number of visible users on the channel 
        /// </param>
        internal ChannelInfo(string name, string topic, int numberVisible)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(name));
            Contract.Requires(topic != null);
            Contract.Requires(numberVisible > 0);
            this.name = name;
            this.topic = topic;
            this.numberVisible = numberVisible;
           
        }

        #endregion

        #region Public Properties

        /// <summary>
        ///   Gets the name of the channel
        /// </summary>
        public string Name
        {
            get
            {
                Contract.Ensures(
                    Contract.Result<string>() == this.name && !string.IsNullOrWhiteSpace(Contract.Result<string>()));
                return this.name;
            }
        }

        /// <summary>
        ///   Gets the number of visible users on the channel
        /// </summary>
        public int NumberVisible
        {
            get
            {
                Contract.Ensures(Contract.Result<int>() == this.numberVisible);
                return this.numberVisible;
            }
        }

        /// <summary>
        ///   Gets the topic of the channel, including formatting information
        /// </summary>
        public string Topic
        {
            get
            {
                Contract.Ensures(Contract.Result<string>() == this.topic);
                return this.topic;
            }
        }

        #endregion
    }
}